Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] multipart S3 file uploads #2590

Merged
merged 10 commits into from
Aug 1, 2024
Merged

Conversation

codetheweb
Copy link
Contributor

@codetheweb codetheweb commented Jul 30, 2024

Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@@ -66,6 +66,7 @@ rayon = "1.8.0"
criterion = "0.3"
random-port = "0.1.1"
serial_test = "3.1.1"
rand_xorshift = "0.3.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

insecure but much faster randomness for tests

@@ -161,13 +167,88 @@ impl S3Storage {
}

pub(crate) async fn put_file(&self, key: &str, path: &str) -> Result<(), S3PutError> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


#[tokio::test]
#[cfg(CHROMA_KUBERNETES_INTEGRATION)]
async fn test_put_file_scenarios() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to use proptest but apparently proptest doesn't work for async functions yet :/

I guess I could block_on if that's preferred

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think some unit tests are good enough here

@codetheweb codetheweb marked this pull request as ready for review July 30, 2024 00:29
@codetheweb codetheweb requested a review from HammadB July 30, 2024 19:20
Ok(())
}

fn part_number_offset_length_iter(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at first I was going to factor out more of the shared multipart upload logic and use an async closure parameter that returns a ByteStream given an offset and length
but was running into some lifetime/type issues so went with this simpler approach for now

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that would have been nice

Copy link
Contributor Author

@codetheweb codetheweb Jul 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

figured out how to do this, much cleaner and now I know a little more about async rust :)

58a42fe

@codetheweb codetheweb force-pushed the feat-multipart-s3-file-uploads branch from e944960 to 8ab22c6 Compare July 30, 2024 20:53
@codetheweb codetheweb requested a review from HammadB July 30, 2024 20:53
@codetheweb codetheweb force-pushed the feat-multipart-s3-file-uploads branch from e772290 to bd0e286 Compare July 30, 2024 22:42
@@ -28,6 +28,7 @@ query_service:
credentials: "Minio"
connect_timeout_ms: 5000
request_timeout_ms: 30000 # 1 minute
part_size_bytes: 8388608 # 8MB
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe "upload_part_size" is clearer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adb5028

I used upload_part_size_bytes since it seemed like the convention was to include units, can drop them if you prefer

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry meant upload_part_size_bytes yes

Copy link
Collaborator

@HammadB HammadB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we should put some time into seeing if we can upload without copying since our data to write can be many GB

@codetheweb codetheweb requested a review from HammadB July 31, 2024 23:15
@codetheweb codetheweb merged commit 9472830 into main Aug 1, 2024
67 checks passed
@codetheweb codetheweb deleted the feat-multipart-s3-file-uploads branch August 1, 2024 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants